<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <title>文章列表--layui后台管理模板 2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="resources/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="resources/css/public.css" media="all" />
</head>
<body class="childrenBody">
<form class="layui-form" id="dataFrm">
    <div class="layui-form-item layui-row">
        原
        <div class="layui-input-block">
            <input type="text"  class="layui-input beforeType" >
        </div>
    </div>
    <input type="text" class="typeCode" id="typeId">

    <div class="layui-form-item layui-row">
        改
        <div class="layui-input-block">
            <input class="layui-input time" id="afterType">
        </div>
    </div>

</form>
<div class="layui-form-item layui-row layui-col-xs12">
    <div class="layui-input-block">
        <button class="layui-btn layui-btn-sm" id="update">修改</button>
        <button type="reset" class="layui-btn layui-btn-sm layui-btn-primary" id="cancel">取消</button>
    </div>
</div>


<script type="text/javascript" src="resources/layui/layui.js"></script>
<script th:inline="none">
    layui.use(['form','layer','laydate','table','laytpl','upload'],function() {
        var form = layui.form
        layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery,
            laydate = layui.laydate,
            laytpl = layui.laytpl,
            table = layui.table,
            upload=layui.upload;
        $(function () {
            $('#update').click(function () {
                var id=$('#typeId').val();
                var type=$('#afterType').val();
                $.ajax({
                    url:'product/editCategory/'+id+'/'+type,
                    type:'PUT',
                    success:function (res) {
                        if(res==200){
                            alert("成功了")
                            layer.close(index);
                            layer.msg('操作成功');
                            var index1=parent.layer.getFrameIndex(window.name)
                            parent.layer.close(index1);
                            parent.location.reload();
                        }
                    }
                });
            });

            $('#cancel').click(function () {
                top.layer.close(index);
                var index1=parent.layer.getFrameIndex(window.name)
                parent.layer.close(index1);
                parent.location.reload();

            });

        })



    });
</script>
</body>
</html>